//
// Created by Administrator on 2025/6/22.
//

#include <stdio.h>
#include <string.h>
#include "build_info.h"
#include "project_config/project_config.h"

static const char *month_names[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};


void show_build_info(void) {
    char month_str[4];
    int day, year, month_num = 0;

    // 解析__DATE__字符串
    sscanf(__DATE__, "%3s %d %d", month_str, &day, &year);

    // 将月份缩写转换为数字
    for (int i = 0; i < 12; i++) {
        if (strcmp(month_str, month_names[i]) == 0) {
            month_num = i + 1;
            break;
        }
    }

    printf("\r\n========================================\r\n");
    printf("%s build at %04d/%02d/%02d %s\r\n", PROJECT_NAME, year, month_num, day, __TIME__);
    printf("\r\n========================================\r\n");
}
